package com.cxf.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBHelper {
	public static Connection getConnection() {
		String driver = "com.mysql.cj.jdbc.Driver";
	    String url = "jdbc:mysql://localhost:3306/message?serverTimezone=GMT%2B8&amp&useSSL=false";
	    String username = "root";
	    String password = "970428";
	    Connection conn = null;
	    try {
	        Class.forName(driver);
	        conn = (Connection) DriverManager.getConnection(url, username, password);
	    } catch (ClassNotFoundException e) {
	        e.printStackTrace();
	    } catch (SQLException e) {
	        System.out.println("连接失败");
	    }
	    return conn;
	}
}
